Skip to content

Fix soft objective bounds after an unbounded lex objective - #11842

Open
fusang991 wants to merge 1 commit into
Z3Prover:masterfrom
fusang991:fix/11820-lex-soft-limit
Open

fusang991 wants to merge 1 commit into
Z3Prover:masterfrom
fusang991:fix/11820-lex-soft-limit

Conversation

@fusang991

@fusang991 fusang991 commented Nov 24, 2026 •

Copy link
Copy Markdown

Fixes #11820.

Minimizing e followed by ite(e = 1, 1, 3) returned -oo and [0, 1]. The upper bound of 1 came from an initial model with e = 1. That model cannot realize the first objective's unbounded direction. Optimize converted the second objective to MaxSMT and skipped it during lexicographic limit computation.

The fix discards model-derived upper bounds for all remaining soft objectives when an earlier objective is unbounded. For each soft objective, it searches for the least penalty cap under which the earlier objective remains unbounded, using the existing unboundedness check. Rational weights determine a discrete cost grid. An exact penalty is committed before processing the next objective. If the round budget is exhausted, the reported interval retains all costs consistent with the probes.

The original input now returns (e (* (- 1) oo)) and a secondary objective of 3.

Validation

  • The native opt_bounds suite covers the reported real-valued ITE, objective and model getters, both optimization directions, fractional soft weights, a dependent third objective, and a zero-round budget.
  • The complete native unit suite passed all 132 test groups (test-z3 /a /j:4).
  • The CLI passed 40 hand-derived cases and 80 generated two-group cases checked against exhaustive Boolean enumeration. An incremental push/check/pop sequence returned secondary optima of 3, 1, and 3.

@github-actions

Copy link
Copy Markdown
Contributor

F* NFV audit: proved

Audited head: 6723a0bac8e9559b4dfbaf6ec8522e86842a4fe0

Partial scope: proved 4 obligations on the bisection loop of execute_soft_after_unbounded (progress, invariant preservation, init, exit optimality) under stated monotonicity assumptions. Other changed functions excluded.

Download the audit sources, report, and log from the run artifacts; no branch writes were attempted.
Workflow run and downloadable evidence (30-day retention)

F* model

module SoftBisect
(* Model of the bisection in opt::context::execute_soft_after_unbounded
   (src/opt/opt_context.cpp @ 6723a0b). P c models "reaches_infinity succeeds
   under cost <= c". Environment assumption: P is monotone (a looser cap cannot
   lose unboundedness) and holds at the total weight (hi0), where the cap is
   vacuous because cost <= sum of weights always. *)

let monotone (p: int -> bool) = forall (a b: int). a <= b /\ p a ==> p b

let mid (lo hi: int) : int = (lo + hi) / 2

let inv (p: int -> bool) (lo hi: int) =
  0 <= lo /\ lo <= hi /\ p hi /\ (forall (c: int). c < lo ==> ~(p c))

let progress (lo hi: int) : Lemma (requires 0 <= lo /\ lo < hi)
  (ensures lo <= mid lo hi /\ mid lo hi < hi) = ()

let step_true (p: int -> bool) (lo hi: int)
  : Lemma (requires inv p lo hi /\ lo < hi /\ p (mid lo hi)) (ensures inv p lo (mid lo hi)) = ()

let step_false (p: int -> bool) (lo hi: int)
  : Lemma (requires inv p lo hi /\ monotone p /\ lo < hi /\ ~(p (mid lo hi)))
          (ensures inv p (mid lo hi + 1) hi) = ()

let init (p: int -> bool) (hi0: int)
  : Lemma (requires 0 <= hi0 /\ p hi0 /\ (forall (c: int). c < 0 ==> ~(p c)))
          (ensures inv p 0 hi0) = ()

let result (p: int -> bool) (lo hi: int)
  : Lemma (requires inv p lo hi /\ lo = hi)
          (ensures p lo /\ (forall (c: int). p c ==> lo <= c)) = ()

let rec loop (p: int -> bool) (lo hi: int) (fuel: nat)
  : Pure (int & int) (requires inv p lo hi /\ monotone p)
         (ensures (fun r -> inv p (fst r) (snd r)))
         (decreases fuel)
  = if lo < hi && fuel > 0 then begin
      let m = mid lo hi in
      if p m then loop p lo m (fuel - 1)
      else loop p (m + 1) hi (fuel - 1)
    end else (lo, hi)

This is a scoped semantic source audit, not mechanized verification of the C++ implementation or the entire PR.
An inconclusive result or an unproved obligation is not evidence of correctness.

Generated by Fstar NFV PR audit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lex optimization: after an unbounded first objective, an ite objective gets an interval that excludes its only possible values

2 participants